From 5a3e27f593aae68c6e868b1a1b832b0691b25b47 Mon Sep 17 00:00:00 2001 From: Platonides Date: Sat, 20 Mar 2010 14:44:11 +0000 Subject: [PATCH] Show an appropiate message when the wiki is read only for some special pages. Note that they show a successful message but wouldn't work since User::saveSettings() silently fails (maybe the user object at memcached could get updated?). --- includes/specials/SpecialConfirmemail.php | 12 ++++++++++++ includes/specials/SpecialMergeHistory.php | 5 +++++ includes/specials/SpecialResetpass.php | 5 +++++ 3 files changed, 22 insertions(+) diff --git a/includes/specials/SpecialConfirmemail.php b/includes/specials/SpecialConfirmemail.php index 372a574cef..7a26d74cae 100644 --- a/includes/specials/SpecialConfirmemail.php +++ b/includes/specials/SpecialConfirmemail.php @@ -25,6 +25,12 @@ class EmailConfirmation extends UnlistedSpecialPage { function execute( $code ) { global $wgUser, $wgOut; $this->setHeaders(); + + if ( wfReadOnly() ) { + $wgOut->readOnlyPage(); + return; + } + if( empty( $code ) ) { if( $wgUser->isLoggedIn() ) { if( User::isValidEmailAddr( $wgUser->getEmail() ) ) { @@ -121,6 +127,12 @@ class EmailInvalidation extends UnlistedSpecialPage { function execute( $code ) { $this->setHeaders(); + + if ( wfReadOnly() ) { + $wgOut->readOnlyPage(); + return; + } + $this->attemptInvalidate( $code ); } diff --git a/includes/specials/SpecialMergeHistory.php b/includes/specials/SpecialMergeHistory.php index 59c924ccc0..275690a750 100644 --- a/includes/specials/SpecialMergeHistory.php +++ b/includes/specials/SpecialMergeHistory.php @@ -54,6 +54,11 @@ class SpecialMergeHistory extends SpecialPage { function execute( $par ) { global $wgOut, $wgRequest, $wgUser; + if ( wfReadOnly() ) { + $wgOut->readOnlyPage(); + return; + } + if( !$this->userCanExecute( $wgUser ) ) { $this->displayRestrictionError(); return; diff --git a/includes/specials/SpecialResetpass.php b/includes/specials/SpecialResetpass.php index 967d2119b1..8c1eee7083 100644 --- a/includes/specials/SpecialResetpass.php +++ b/includes/specials/SpecialResetpass.php @@ -19,6 +19,11 @@ class SpecialResetpass extends SpecialPage { function execute( $par ) { global $wgUser, $wgAuth, $wgOut, $wgRequest; + if ( wfReadOnly() ) { + $wgOut->readOnlyPage(); + return; + } + $this->mUserName = $wgRequest->getVal( 'wpName' ); $this->mOldpass = $wgRequest->getVal( 'wpPassword' ); $this->mNewpass = $wgRequest->getVal( 'wpNewPassword' ); -- 2.20.1